m_service.AutodiscoverUrl giving  Exception The specified name is not a forest, Active Directory domain controller, ADAM instance, or ADAM configuration set. Parameter name

m_service = new ExchangeService(ExchangeVersion.Exchange2010_SP1);

m_service.Credentials = new WebCredentials(m_username, m_password);

m_service.AutodiscoverUrl(m_username", RedirectionUrlValidationCallback);

 

//sometimes it gives the correct endpoints but when i restart my computer it give the following error:

The specified name is not a forest, Active Directory domain controller, ADAM instance, or ADAM configuration set. Parameter name

and again after some time it gives me correct endpints.

 

How can i make Autodiscover service more stable ?

 

 

August 17th, 2011 10:41am

It sounds like the SCP lookup of Active Directory is the cause if you have DNS configured correctly for Autodiscover you could use the autodiscover classes and disable the SCP lookup eg
       AutodiscoverService ads = new Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverService();
      ads.EnableScpLookup = false;
      ads.TraceEnabled = false;
      ads.RedirectionUrlValidationCallback = delegate { return true; };
      ads.Credentials = new NetworkCredential("Glen@domain.com", "password");
      UserSettingName[] usSetting = new UserSettingName[1];
      usSetting[0] = UserSettingName.ExternalEwsUrl;
      GetUserSettingsResponse grResp = ads.GetUserSettings("Glen@domain.com", usSetting);
      Uri casURI = new Uri(grResp.Settings[Microsoft.Exchange.WebServices.Autodiscover.UserSettingName.ExternalEwsUrl].ToString());

Cheers
Glen
Free Windows Admin Tool Kit Click here and download it now
August 18th, 2011 8:19am

I copied and pasted that code on my code but it says that namesapce AutodiscoverService, UserSettingName and GetUserSettingsResponse are missing. Am i missing a reference or something?

EDIT:
Solved it, missing a namespace


Another Question, Does this mean that we need to use that code instead of

service.AutoDiscoverUrl(domainname,setting)

August 8th, 2013 4:49am

Yes

Cheers
Glen

Free Windows Admin Tool Kit Click here and download it now
August 12th, 2013 3:07am

Hi there,

I have a quick question. When i use your code from above instead of service.AutoDiscoverUrl(domainname,setting), i get an error saying that 'autodiscover server could not be located'. But when i use service.AutoDiscoverUrl(domainname,setting) and not the code you posted above. It is working, but im a afraid it is not stable just like the original question.

Can you help me with this issue? 

Thanks

August 21st, 2013 5:06am

Generally that error is because of the Credentials you're trying if you enable tracing you can see verbosely what is happening. Every environment is different so without knowing more about your environment its hard to comment. You can use https://www.testexchangeconnectivity.com/ to test your Autodiscover DNS setting externally.

If you're using service.AutoDiscoverUrl and you haven't disabled SCP lookup then your code maybe working because it just using the EndPoint in Active Directory. The code I've posted doesn't use the AD endpoint but just uses DNS.

Cheers
Glen


Free Windows Admin Tool Kit Click here and download it now
August 21st, 2013 10:49pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics